import java.util.Scanner;

public class Main1585 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        double s = 0.0;
        for (int i = 0; i < n; i++) {
            s = s + arr[i];
        }
        float avg =(float) s/n;
        float a = Math.abs(avg-arr[0]);//设平均值和数组第一个元素的差起始差值
        int b = arr[0];//设数组第一个元素为最接近平均值的元素
        for(int i=0; i<n; i++) {
            if(a >= Math.abs(avg-arr[i])) {
                //当a>=平均数与数组第i号元素的差的绝对值，则a重新赋值为第i号元素与平均数的差
                a = Math.abs(avg-arr[i]);
                b = arr[i];

            }
        }
        System.out.print(b);
    }
}
